<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>九宫格——用html+css制作一个网页</title>
    <style>
      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }
      :root {
        --cell-size: min(33vh, 33vw);
      }

      html,
      body {
        height: 100%;
      }
      .container {
        margin: 0 auto;
        width: 100%;
        /* justify-content: space-between; */
        height: 100%;
        margin-bottom: 8px;
      }

      .row {
        display: flex;
        justify-content: center;
      }
      body .row:last-child {
        margin-bottom: 0;
      }
      .cell {
        width: var(--cell-size);
        height: var(--cell-size);
        margin-right: 0.5vh;
        margin-bottom: 0.5vh;
        border-radius: 10px;
        align-content: space-between;
        background-color: orange;
        text-align: center;
        line-height: var(--cell-size);
        font-size: 2rem;
      }

      .row .cell:last-child {
        margin-right: 0;
        margin-bottom: 0;
      }
    </style>
  </head>
  <body>
    <div class="container">
      <div class="row">
        <div class="cell">1</div>
        <div class="cell">2</div>
        <div class="cell">3</div>
      </div>
      <div class="row">
        <div class="cell">4</div>
        <div class="cell">5</div>
        <div class="cell">6</div>
      </div>
      <div class="row">
        <div class="cell">7</div>
        <div class="cell">8</div>
        <div class="cell">9</div>
      </div>
    </div>
  </body>
</html>
